﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GameEngine;
using Microsoft.Xna.Framework;

namespace GameBoardViewer.Animation
{
    internal class JumpMoveAnimation: MoveAnimation
    {
        protected Vector3 _startRay;
        protected Vector3 _finishRay;

        public JumpMoveAnimation(Position figurePos, Vector3 startPos, Vector3 finishPos, TimeSpan animationLength)
            : base(figurePos, startPos, finishPos, animationLength)
        {
        }

        public override void StartAnimation()
        {
            base.StartAnimation();

            Vector3 middlePoint = (_startPos + _finishPos) / 2;         
            middlePoint.Z -= 12f;

            _startRay = middlePoint - _startPos;
            _finishRay = _finishPos - middlePoint;
        }

        protected override Vector3 CalculatePosition(float elapsedTime)
        {
            return Vector3.Hermite(_startPos, _startRay, _finishPos, _finishRay, elapsedTime);
        }

    }
}
